//
//  NavigatorCollectionViewCell.m
//  SuperRadio
//
//  Created by Damon on 14/12/18.
//  Copyright (c) 2014年 三个臭皮匠. All rights reserved.
//

#import "NavigatorCollectionViewCell.h"
#import "Categories.h"
#import "UIImageView+WebCache.h"
@interface NavigatorCollectionViewCell ()

@property (nonatomic, retain) UIImageView *navigatorImageView;

@end


@implementation NavigatorCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.navigatorImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.navigatorImageView];
        [_navigatorImageView release];
        
    }
    
    return self;
}

- (void)setCategories:(Categories *)categories
{
    
    if (_categories != categories) {
        [_categories release];
         _categories = [categories retain];
    }
    
    [self.navigatorImageView setImageWithURL:[NSURL URLWithString:[self.categories.coverPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
    
}

- (void)layoutSubviews
{
    
    [super layoutSubviews];
    
    self.navigatorImageView.frame = CGRectMake(0, 0, self.contentView.frame.size.height, self.contentView.frame.size.height);
    

}

- (void)dealloc
{
    [_categories release];
    [_navigatorImageView release];
    [super dealloc];
}

@end
